<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        let arr = ['aa','bb','cc','dd','ee'];
        let s = '|';
        function slipt(arr,s){
            let t = '';
            for(let i = 0;i < arr.length-1;++i)
               t += arr[i]+s;
                t += arr[arr.length-1]
                console.log(t); 
        }
        slipt(arr,s);

    </script>
</body>
</html>
